VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmParametrosFondos 
   BackColor       =   &H00FFFFFF&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Parametros Fondos"
   ClientHeight    =   3150
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4470
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   3150
   ScaleWidth      =   4470
   Begin VB.Frame Frame1 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Conceptos por defecto"
      Height          =   2535
      Left            =   120
      TabIndex        =   3
      Top             =   480
      Width           =   4215
      Begin VB.ComboBox cmbGC2 
         Appearance      =   0  'Flat
         Height          =   315
         Left            =   120
         Style           =   2  'Dropdown List
         TabIndex        =   6
         Top             =   2040
         Width           =   3975
      End
      Begin VB.ComboBox cmbObr 
         Appearance      =   0  'Flat
         Height          =   315
         Left            =   120
         Style           =   2  'Dropdown List
         TabIndex        =   0
         Top             =   600
         Width           =   3975
      End
      Begin VB.ComboBox cmbProf 
         Appearance      =   0  'Flat
         Height          =   315
         Left            =   120
         Style           =   2  'Dropdown List
         TabIndex        =   1
         Top             =   1320
         Width           =   3975
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BackStyle       =   0  'Transparent
         Caption         =   "Gastos GC2:"
         Height          =   195
         Left            =   120
         TabIndex        =   7
         Top             =   1800
         Width           =   900
      End
      Begin VB.Label Label4 
         BackColor       =   &H00FFFFFF&
         Caption         =   "Cobranza Obra Social:"
         Height          =   255
         Left            =   120
         TabIndex        =   5
         Top             =   360
         Width           =   2415
      End
      Begin VB.Label Label5 
         BackColor       =   &H00FFFFFF&
         Caption         =   "Pago Profesional:"
         Height          =   255
         Left            =   120
         TabIndex        =   4
         Top             =   1080
         Width           =   2415
      End
   End
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   2280
      Top             =   0
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   16
      ImageHeight     =   16
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   11
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmParametrosFondos.frx":0000
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmParametrosFondos.frx":059A
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmParametrosFondos.frx":0B34
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmParametrosFondos.frx":10CE
            Key             =   ""
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmParametrosFondos.frx":1668
            Key             =   ""
         EndProperty
         BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmParametrosFondos.frx":1C02
            Key             =   ""
         EndProperty
         BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmParametrosFondos.frx":219C
            Key             =   ""
         EndProperty
         BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmParametrosFondos.frx":2736
            Key             =   ""
         EndProperty
         BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmParametrosFondos.frx":2CD0
            Key             =   ""
         EndProperty
         BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmParametrosFondos.frx":326A
            Key             =   ""
         EndProperty
         BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmParametrosFondos.frx":3804
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.Toolbar Toolbar1 
      Align           =   1  'Align Top
      Height          =   360
      Left            =   0
      TabIndex        =   2
      Top             =   0
      Width           =   4470
      _ExtentX        =   7885
      _ExtentY        =   635
      ButtonWidth     =   609
      ButtonHeight    =   582
      Appearance      =   1
      Style           =   1
      ImageList       =   "ImageList1"
      _Version        =   393216
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
         NumButtons      =   5
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
         BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "Aceptar"
            Object.ToolTipText     =   "Aceptar (F5)"
            ImageIndex      =   5
         EndProperty
         BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
         BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "Salir"
            Object.ToolTipText     =   "Salir (Esc)"
            ImageIndex      =   11
         EndProperty
         BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
      EndProperty
      BorderStyle     =   1
   End
End
Attribute VB_Name = "frmParametrosFondos"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim con As New ConBaseDatos

Private Sub Grabar()

Dim datos As String

datos = "concepto_cobranza_obra_social:" & ReplicarCaracter("0", LargoID, cmbObr.ItemData(cmbObr.ListIndex)) & "<||>" & _
        "concepto_pago_profesional:" & ReplicarCaracter("0", LargoID, cmbProf.ItemData(cmbProf.ListIndex)) & "<||>" & _
        "concepto_gastos_gc2:" & ReplicarCaracter("0", LargoID, cmbGC2.ItemData(cmbGC2.ListIndex)) & "<||>"
        
If con.ExisteDatos("parametros", "parametro='0000000002'") Then
    con.ActualizarRegistros "parametros", "descripcion,datos", "'Parametros Fondos','" & datos & "'", "parametro='0000000002'"
Else
    con.InsertarRegistros "parametros", "parametro,descripcion,datos", "'0000000002','Parametros Fondos','" & datos & "'"
End If

End Sub

Private Function Control() As Boolean

Control = False

If cmbObr.ListIndex = -1 Then
    Control = True
    MsgBox "Seleccione concepto cobranza obra social", vbCritical, "Error datos"
    cmbObr.SetFocus

ElseIf cmbProf.ListIndex = -1 Then
    Control = True
    MsgBox "Seleccione concepto pago profesional", vbCritical, "Error datos"
    cmbProf.SetFocus
    
ElseIf cmbGC2.ListIndex = -1 Then
    Control = True
    MsgBox "Seleccione concepto gastos GC2", vbCritical, "Error datos"
    cmbGC2.SetFocus
    
End If

End Function

Private Sub Form_Load()

Dim i As Integer, j As Integer, cProf As Integer, cObr As Integer, cGC2 As Integer
Dim datos() As String, dato() As String, k As Integer

Abrir Me
Me.Icon = frmPrincipal.Icon

con.AbrirRegistros "select * from parametros where parametro='0000000002'", Consulta
If Not con.Registros.EOF Then
    datos = Split(con.Registros("datos"), "<||>")
    
    dato = Split(datos(0), ":")
    cObr = dato(1)
    
    dato = Split(datos(1), ":")
    cProf = dato(1)
    
    On Error Resume Next
    dato = Split(datos(2), ":")
    cGC2 = dato(1)
    On Error GoTo 0
End If
con.CerrarRegistros

'obras sociales
con.AbrirRegistros "select concepto,codigo+'-'+nombre as nom from conceptos where tipo='ingreso' order by nombre", Consulta
i = -1
j = 0
Do While Not con.Registros.EOF
    cmbObr.AddItem DesEditar(con.Registros("nom"))
    cmbObr.ItemData(cmbObr.NewIndex) = CInt(con.Registros("concepto"))
    If cmbObr.ItemData(cmbObr.NewIndex) = cObr Then i = j
    con.Registros.MoveNext
    j = j + 1
    DoEvents
Loop
con.CerrarRegistros
cmbObr.ListIndex = i


'profesionales
con.AbrirRegistros "select concepto,codigo+'-'+nombre as nom from conceptos where tipo='egreso' order by nombre", Consulta
i = -1
k = -1
j = 0
Do While Not con.Registros.EOF
    cmbProf.AddItem DesEditar(con.Registros("nom"))
    cmbProf.ItemData(cmbProf.NewIndex) = CInt(con.Registros("concepto"))
    If cmbProf.ItemData(cmbProf.NewIndex) = cProf Then i = j
    
    cmbGC2.AddItem DesEditar(con.Registros("nom"))
    cmbGC2.ItemData(cmbGC2.NewIndex) = CInt(con.Registros("concepto"))
    If cmbGC2.ItemData(cmbGC2.NewIndex) = cGC2 Then k = j
    
    con.Registros.MoveNext
    j = j + 1
    DoEvents
Loop
con.CerrarRegistros
cmbProf.ListIndex = i
cmbGC2.ListIndex = k

End Sub

Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)

Select Case KeyCode
    Case 27 'Escape "Salir"
        If Toolbar1.Buttons(4).Enabled Then Toolbar1_ButtonClick Toolbar1.Buttons(4)
        
    Case 112 'F1 "Ayuta"
        frmPrincipal.manual_Click
            
    Case 116 'F5 "Aceptar"
        If Toolbar1.Buttons(2).Enabled Then Toolbar1_ButtonClick Toolbar1.Buttons(2)
        
End Select

End Sub

Private Sub Form_Unload(Cancel As Integer)

If Not Toolbar1.Buttons(4).Enabled Then Cancel = True

End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)

Select Case Button.Key
         
    Case "Salir"
        Unload Me
    
    Case "Aceptar"
        If Control Then Exit Sub
        Grabar
        Unload Me
        
End Select

End Sub

Private Sub cmbGC2_GotFocus()

cmbGC2.BackColor = &HFFFFC0

End Sub

Private Sub cmbGC2_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then
    KeyAscii = 0
    If Toolbar1.Buttons(2).Enabled Then Toolbar1_ButtonClick Toolbar1.Buttons(2)
End If

End Sub

Private Sub cmbGC2_LostFocus()

cmbGC2.BackColor = &H80000005

End Sub

Private Sub cmbProf_GotFocus()

cmbProf.BackColor = &HFFFFC0

End Sub

Private Sub cmbProf_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then
    KeyAscii = 0
    SendKeys "{TAB}"
End If

End Sub

Private Sub cmbProf_LostFocus()

cmbProf.BackColor = &H80000005

End Sub

Private Sub cmbObr_GotFocus()

cmbObr.BackColor = &HFFFFC0

End Sub

Private Sub cmbObr_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then
    KeyAscii = 0
    SendKeys "{TAB}"
End If

End Sub

Private Sub cmbObr_LostFocus()

cmbObr.BackColor = &H80000005

End Sub
